/*
 */
package com.muse.jdkdp;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * @author muse
 */
public class JDKSPTest {
    public static void main(String[] args) {
//        System.setProperty("jdk.proxy.ProxyGenerator.saveGeneratedFiles", "true");
//        System.setProperty("sun.misc.ProxyGenerator.saveGeneratedFiles", "true");

        SwitchGame switchGame = new SwitchGame();
        InvocationHandlerImpl handler = new InvocationHandlerImpl(switchGame);

        Game switchGameProxy = (Game) handler.getProxy();

        System.out.println("动态代理对象的类型=" + switchGameProxy.getClass().getName());
        System.out.println("switchGameProxy.play()=" + switchGameProxy.play());
    }
}
